<!DOCTYPE html>
<html lang="en" data-scrapbook-source="https://github.com/iamkun/dayjs/blob/dev/docs/zh-cn/Plugin.md" data-scrapbook-create="20200112075805177">

<head>
    <meta charset="UTF-8">

    <link media="all" rel="stylesheet" href="css/frameworks-02a3eaa24db2bd1ed9b64450595fc2cf.css">
    <link media="all" rel="stylesheet" href="css/github-be4e45349cf088df7a6636f437c0a167.css">






    <meta name="viewport" content="width=device-width">

    <title>dayjs/Plugin.md at dev · iamkun/dayjs</title>
    <meta name="description" content="⏰ Day.js 2KB immutable date library alternative to Moment.js with the same modern API - iamkun/dayjs">
    <link rel="search" type="application/opensearchdescription+xml" href="https://github.com/opensearch.xml" title="GitHub">
    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
    <meta property="fb:app_id" content="1401488693436528">

    <meta name="twitter:image:src" content="https://avatars1.githubusercontent.com/u/17680888?s=400&amp;v=4">
    <meta name="twitter:site" content="@github">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="iamkun/dayjs">
    <meta name="twitter:description" content="⏰ Day.js 2KB immutable date library alternative to Moment.js with the same modern API - iamkun/dayjs">
    <meta property="og:image" content="https://avatars1.githubusercontent.com/u/17680888?s=400&amp;v=4">
    <meta property="og:site_name" content="GitHub">
    <meta property="og:type" content="object">
    <meta property="og:title" content="iamkun/dayjs">
    <meta property="og:url" content="https://github.com/iamkun/dayjs">
    <meta property="og:description" content="⏰ Day.js 2KB immutable date library alternative to Moment.js with the same modern API - iamkun/dayjs">

    <link rel="assets" href="https://github.githubassets.com/">
    <link rel="web-socket" href="wss://live.github.com/_sockets/VjI6NDc5Mjg5NTEwOjY4NWQ1N2M4ZmJmODExYWY4MmE1ZGUyNjAxOTZiNzNkMDIxOGJlZjgzMWVmNjZmMWVkNWVjNTI4ZjA3OGZiMzE=--7df4f9410bfd11493658969cb3c32f8aa188606e">
    <link rel="sudo-modal" href="https://github.com/sessions/sudo_modal">

    <meta name="request-id" content="F11A:67C8:176F9EA:2218BAD:5E1AD16F" data-pjax-transient="">





    <meta name="selected-link" value="repo_source" data-pjax-transient="">

    <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
    <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
    <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc">

    <meta name="octolytics-host" content="collector.githubapp.com">
    <meta name="octolytics-app-id" content="github">
    <meta name="octolytics-event-url" content="https://collector.githubapp.com/github-external/browser_event">
    <meta name="octolytics-dimension-request_id" content="F11A:67C8:176F9EA:2218BAD:5E1AD16F">
    <meta name="octolytics-dimension-region_edge" content="ap-southeast-1">
    <meta name="octolytics-dimension-region_render" content="iad">
    <meta name="octolytics-dimension-ga_id" content="1742038990.1576111508" class="js-octo-ga-id">
    <meta name="octolytics-dimension-visitor_id" content="1047302758521212284">
    <meta name="octolytics-actor-id" content="3016136">
    <meta name="octolytics-actor-login" content="ywzhaiqi">
    <meta name="octolytics-actor-hash" content="d71b6bc0aa25b967ee178c100432ca20aeec0c8a8c9c1a37735b1fb20b4edbc2">

    <meta name="analytics-location" content="/<user-name>/<repo-name>/blob/show" data-pjax-transient="true">



    <meta name="google-analytics" content="UA-3769691-2">

    <meta class="js-ga-set" name="userId" content="cf9523941672d8fcd3ad253396223e95">

    <meta class="js-ga-set" name="dimension1" content="Logged In">





    <meta name="hostname" content="github.com">
    <meta name="user-login" content="ywzhaiqi">

    <meta name="expected-hostname" content="github.com">

    <meta name="js-proxy-site-detection-payload" content="YmFkNWU2OGIxNjY4ZmJiZjlkNzMwMTM1MjJiYTUxZDA4ZTNhZWZiZWE2OTdkMDZiNzRiMjU4YzZkOGNiODJlZHx7InJlbW90ZV9hZGRyZXNzIjoiMTE1LjIxMi4xMzcuMjYiLCJyZXF1ZXN0X2lkIjoiRjExQTo2N0M4OjE3NkY5RUE6MjIxOEJBRDo1RTFBRDE2RiIsInRpbWVzdGFtcCI6MTU3ODgxNTg2MCwiaG9zdCI6ImdpdGh1Yi5jb20ifQ==">

    <meta name="enabled-features" content="MARKETPLACE_FEATURED_BLOG_POSTS,MARKETPLACE_INVOICED_BILLING,MARKETPLACE_SOCIAL_PROOF_CUSTOMERS,MARKETPLACE_TRENDING_SOCIAL_PROOF,MARKETPLACE_RECOMMENDATIONS,MARKETPLACE_PENDING_INSTALLATIONS,NOTIFY_ON_BLOCK,RELATED_ISSUES,GHE_CLOUD_TRIAL">

    <meta name="html-safe-nonce" content="7443dcef14e1661ba10ebbbf42c585eb25460c20">

    <meta http-equiv="x-pjax-version" content="29b5f5033ff3b50651b46612f0a560d2">


    <link href="https://github.com/iamkun/dayjs/commits/dev.atom" rel="alternate" title="Recent Commits to dayjs:dev" type="application/atom+xml">

    <meta name="go-import" content="github.com/iamkun/dayjs git https://github.com/iamkun/dayjs.git">

    <meta name="octolytics-dimension-user_id" content="17680888">
    <meta name="octolytics-dimension-user_login" content="iamkun">
    <meta name="octolytics-dimension-repository_id" content="128907699">
    <meta name="octolytics-dimension-repository_nwo" content="iamkun/dayjs">
    <meta name="octolytics-dimension-repository_public" content="true">
    <meta name="octolytics-dimension-repository_is_fork" content="false">
    <meta name="octolytics-dimension-repository_network_root_id" content="128907699">
    <meta name="octolytics-dimension-repository_network_root_nwo" content="iamkun/dayjs">
    <meta name="octolytics-dimension-repository_explore_github_marketplace_ci_cta_shown" content="false">


    <link rel="canonical" href="https://github.com/iamkun/dayjs/blob/dev/docs/zh-cn/Plugin.md" data-pjax-transient="">


    <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">

    <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">

    <link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000">
    <link rel="icon" type="image/x-icon" class="js-site-favicon" href="favicon.ico">

    <meta name="theme-color" content="#1e2327">


    <link rel="manifest" href="https://github.com/manifest.json">

</head>

<body class="logged-in env-production page-responsive page-blob">
    <div class="application-main " data-commit-hovercards-enabled="">
        <div itemscope="" itemtype="http://schema.org/SoftwareSourceCode" class="">
            <main>
                <div class="container-lg clearfix new-discussion-timeline experiment-repo-nav  p-responsive">
                    <div class="repository-content ">
                        <div class="Box mt-3 position-relative">
                            <div id="readme" class="Box-body readme blob js-code-block-container">
                                <article class="markdown-body entry-content p-3 p-md-6" itemprop="text">
                                    <!--scrapbook-capture-selected-->
                                    <h1>插件列表</h1>
                                    <p>插件是一些独立的程序，可以给 Day.js 增加新功能和扩展已有功能</p>
                                    <p>默认情况下，Day.js 只包含核心的代码，并没有安装任何插件</p>
                                    <p>您可以加载多个插件来满足您的需求</p>
                                    <h2><a id="api" class="anchor" aria-hidden="true" href="#api"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>API</h2>
                                    <h4><a id="extend" class="anchor" aria-hidden="true" href="#extend"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Extend</h4>
                                    <ul>
                                        <li>将返回 dayjs 类</li>
                                    </ul>
                                    <p>使用插件</p>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">plugin</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">plugin</span><span class="pl-kos">)</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">plugin</span><span class="pl-kos">,</span> <span class="pl-s1">options</span><span class="pl-kos">)</span> <span class="pl-c">// 带参数加载插件</span></pre></div>
                                    <h2><a id="安装" class="anchor" aria-hidden="true" href="#安装"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>安装</h2>
                                    <ul>
                                        <li>通过 NPM:</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">dayjs</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs'</span>
<span class="pl-k">import</span> <span class="pl-s1">advancedFormat</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/advancedFormat'</span> <span class="pl-c">// 按需加载</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">advancedFormat</span><span class="pl-kos">)</span> <span class="pl-c">// 使用插件</span></pre></div>
                                    <ul>
                                        <li>通过 CDN:</li>
                                    </ul>
                                    <div class="highlight highlight-text-html-basic"><pre><span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">src</span>="<span class="pl-s">https://unpkg.com/dayjs</span>"<span class="pl-kos">&gt;</span><span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
<span class="pl-c">&lt;!-- 通过 window.dayjs_plugin_NAME 获取 --&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">src</span>="<span class="pl-s">https://unpkg.com/dayjs/plugin/advancedFormat</span>"<span class="pl-kos">&gt;</span><span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
  <span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">dayjs_plugin_advancedFormat</span><span class="pl-kos">)</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span></pre></div>
                                    <h2><a id="官方插件列表" class="anchor" aria-hidden="true" href="#官方插件列表"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>官方插件列表</h2>
                                    <h3><a id="utc" class="anchor" aria-hidden="true" href="#utc"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>UTC</h3>
                                    <ul>
                                        <li>UTC 增加了 <code>.utc</code> <code>.local</code> <code>.isUTC</code> APIs 使用 UTC 模式来解析和展示时间.</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">utc</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/utc'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">utc</span><span class="pl-kos">)</span>

<span class="pl-c">// 默认当地时间</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">//2019-03-06T17:11:55+08:00</span>
<span class="pl-c">// UTC 模式</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">utc</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 2019-03-06T09:11:55Z</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">.</span><span class="pl-en">utc</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 2019-03-06T09:11:55Z</span>
<span class="pl-c">// 在 UTC 模式下，所有的展示方法都将使用 UTC 而不是本地时区</span>
<span class="pl-c">// 所有的 get 和 set 方法也都会使用 Date#getUTC* 和 Date#setUTC* 而不是 Date#get* and Date#set*</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">utc</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isUTC</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// true</span>
<span class="pl-s1">dayjs</span>
  <span class="pl-kos">.</span><span class="pl-en">utc</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">.</span><span class="pl-en">local</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  <span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">//2019-03-06T17:11:55+08:00</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">utc</span><span class="pl-kos">(</span><span class="pl-s">'2018-01-01'</span><span class="pl-kos">,</span> <span class="pl-s">'YYYY-MM-DD'</span><span class="pl-kos">)</span> <span class="pl-c">// with CustomParseFormat plugin</span></pre></div>
                                    <p>Day.js 默认使用用户本地时区来解析和展示时间。 如果想要使用 UTC 模式来解析和展示时间，可以使用 <code>dayjs.utc()</code> 而不是 <code>dayjs()</code></p>
                                    <h4>
                                        <a id="dayjsutc-dayjsutcdatetype-string--number--date--dayjs-format-string" class="anchor" aria-hidden="true" href="#dayjsutc-dayjsutcdatetype-string--number--date--dayjs-format-string"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>dayjs.utc
                                        <code>dayjs.utc(dateType?: string | number | Date | Dayjs, format? string)</code></h4>
                                    <p>返回一个使用 UTC 模式的 <code>Dayjs</code> 对象。</p>
                                    <h4><a id="use-utc-time-utc" class="anchor" aria-hidden="true" href="#use-utc-time-utc"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use
                                        UTC time <code>.utc()</code></h4>
                                    <p>返回一个复制的包含使用 UTC 模式标记的 <code>Dayjs</code> 对象。</p>
                                    <h4><a id="use-local-time-local" class="anchor" aria-hidden="true" href="#use-local-time-local"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Use
                                        local time <code>.local()</code></h4>
                                    <p>返回一个复制的包含使用本地时区标记的 <code>Dayjs</code> 对象。</p>
                                    <h4><a id="isutc-mode-isutc" class="anchor" aria-hidden="true" href="#isutc-mode-isutc"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>isUTC
                                        mode <code>.isUTC()</code></h4>
                                    <p>返回一个 <code>boolean</code> 来展示当前 <code>Dayjs</code> 对象是不是在 UTC 模式下。</p>
                                    <h3><a id="advancedformat" class="anchor" aria-hidden="true" href="#advancedformat"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>AdvancedFormat</h3>
                                    <ul>
                                        <li>AdvancedFormat 扩展了 <code>dayjs().format</code> API 以支持更多模版</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-v">AdvancedFormat</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/advancedFormat'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-v">AdvancedFormat</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-s">'Q Do k kk X x'</span><span class="pl-kos">)</span></pre></div>
                                    <p>扩展的模版列表：</p>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>模版</th>
                                                <th>输出</th>
                                                <th>简介</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td><code>Q</code></td>
                                                <td>1-4</td>
                                                <td>季度</td>
                                            </tr>
                                            <tr>
                                                <td><code>Do</code></td>
                                                <td>1st 2nd ... 31st</td>
                                                <td>带序号的月份</td>
                                            </tr>
                                            <tr>
                                                <td><code>k</code></td>
                                                <td>1-24</td>
                                                <td>时：由 1 开始</td>
                                            </tr>
                                            <tr>
                                                <td><code>kk</code></td>
                                                <td>01-24</td>
                                                <td>时：由 1 开始，二位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>X</code></td>
                                                <td>1360013296</td>
                                                <td>秒为单位的 Unix 时间戳</td>
                                            </tr>
                                            <tr>
                                                <td><code>x</code></td>
                                                <td>1360013296123</td>
                                                <td>毫秒单位的 Unix 时间戳</td>
                                            </tr>
                                            <tr>
                                                <td><code>w</code></td>
                                                <td>1 2 ... 52 53</td>
                                                <td>年中第几周 (依赖: weekOfYear 插件)</td>
                                            </tr>
                                            <tr>
                                                <td><code>ww</code></td>
                                                <td>01 02 ... 52 53</td>
                                                <td>年中第几周，二位数 (依赖: weekOfYear 插件)</td>
                                            </tr>
                                            <tr>
                                                <td><code>wo</code></td>
                                                <td>1st 2nd ... 52nd 53rd</td>
                                                <td>带序号的年中第几周 (依赖: weekOfYear 插件)</td>
                                            </tr>
                                            <tr>
                                                <td><code>gggg</code></td>
                                                <td>2017</td>
                                                <td>根据周计算的年份 (依赖: weekYear 插件)</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <h3><a id="localizedformat" class="anchor" aria-hidden="true" href="#localizedformat"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>LocalizedFormat</h3>
                                    <ul>
                                        <li>LocalizedFormat 扩展了 <code>dayjs().format</code> API 以支持更多本地化的长日期格式.</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-v">LocalizedFormat</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/localizedFormat'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-v">LocalizedFormat</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-s">'L LT'</span><span class="pl-kos">)</span></pre></div>
                                    <p>扩展的模版列表:</p>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>模版</th>
                                                <th>格式</th>
                                                <th>输出</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td><code>LT</code></td>
                                                <td>HH:mm</td>
                                                <td>8:02</td>
                                            </tr>
                                            <tr>
                                                <td><code>LTS</code></td>
                                                <td>HH:mm:ss</td>
                                                <td>15:25:50</td>
                                            </tr>
                                            <tr>
                                                <td><code>L</code></td>
                                                <td>YYYY/MM/DD</td>
                                                <td>2010/02/14</td>
                                            </tr>
                                            <tr>
                                                <td><code>LL</code></td>
                                                <td>YYYY 年 M 月 D 日</td>
                                                <td>2010 年 2 月 14 日</td>
                                            </tr>
                                            <tr>
                                                <td><code>LLL</code></td>
                                                <td>YYYY 年 M 月 D 日 Ah 点 mm 分</td>
                                                <td>2010 年 2 月 14 日下午 3 点 25 分</td>
                                            </tr>
                                            <tr>
                                                <td><code>LLLL</code></td>
                                                <td>YYYY 年 M 月 D 日 ddddAh 点 mm 分</td>
                                                <td>2010 年 2 月 14 日星期日下午 3 点 25 分</td>
                                            </tr>
                                            <tr>
                                                <td><code>l</code></td>
                                                <td>YYYY/M/D</td>
                                                <td>2010/2/14</td>
                                            </tr>
                                            <tr>
                                                <td><code>ll</code></td>
                                                <td>YYYY 年 M 月 D 日</td>
                                                <td>2010 年 2 月 14 日</td>
                                            </tr>
                                            <tr>
                                                <td><code>lll</code></td>
                                                <td>YYYY 年 M 月 D 日 HH:mm</td>
                                                <td>2010 年 2 月 14 日 15:25</td>
                                            </tr>
                                            <tr>
                                                <td><code>llll</code></td>
                                                <td>YYYY 年 M 月 D 日 dddd HH:mm</td>
                                                <td>2010 年 2 月 14 日星期日 15:25</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <h3><a id="relativetime" class="anchor" aria-hidden="true" href="#relativetime"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>RelativeTime</h3>
                                    <ul>
                                        <li>RelativeTime 增加了 <code>.from</code> <code>.to</code> <code>.fromNow</code> <code>.toNow</code> 4 个 API 来展示相对的时间 (e.g. 3 小时以前).</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">relativeTime</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/relativeTime'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">relativeTime</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">from</span><span class="pl-kos">(</span><span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'1990'</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-c">// 2 年以前</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">from</span><span class="pl-kos">(</span><span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-c1">true</span><span class="pl-kos">)</span> <span class="pl-c">// 2 年</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">fromNow</span><span class="pl-kos">(</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">to</span><span class="pl-kos">(</span><span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toNow</span><span class="pl-kos">(</span><span class="pl-kos">)</span></pre></div>
                                    <h4><a id="距离现在的相对时间-fromnowwithoutsuffix-boolean" class="anchor" aria-hidden="true" href="#距离现在的相对时间-fromnowwithoutsuffix-boolean"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>距离现在的相对时间
                                        <code>.fromNow(withoutSuffix?: boolean)</code></h4>
                                    <p>返回 <code>string</code> 距离现在的相对时间</p>
                                    <h4>
                                        <a id="距离-x-的相对时间-fromcompared-dayjs-withoutsuffix-boolean" class="anchor" aria-hidden="true" href="#距离-x-的相对时间-fromcompared-dayjs-withoutsuffix-boolean"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>距离
                                        X 的相对时间 <code>.from(compared: Dayjs, withoutSuffix?: boolean)</code></h4>
                                    <p>返回 <code>string</code> 距离 X 的相对时间</p>
                                    <h4><a id="到现在的相对时间-tonowwithoutsuffix-boolean" class="anchor" aria-hidden="true" href="#到现在的相对时间-tonowwithoutsuffix-boolean"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>到现在的相对时间
                                        <code>.toNow(withoutSuffix?: boolean)</code></h4>
                                    <p>返回 <code>string</code> 到现在的相对时间</p>
                                    <h4>
                                        <a id="到-x-的相对时间-tocompared-dayjs-withoutsuffix-boolean" class="anchor" aria-hidden="true" href="#到-x-的相对时间-tocompared-dayjs-withoutsuffix-boolean"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>到
                                        X 的相对时间 <code>.to(compared: Dayjs, withoutSuffix?: boolean)</code></h4>
                                    <p>返回 <code>string</code> 到 X 的相对时间</p>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>Range</th>
                                                <th>Key</th>
                                                <th>Sample Output</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>0 到 44 秒</td>
                                                <td>s</td>
                                                <td>几秒前</td>
                                            </tr>
                                            <tr>
                                                <td>45 到 89 秒</td>
                                                <td>m</td>
                                                <td>1 分钟前</td>
                                            </tr>
                                            <tr>
                                                <td>90 秒 到 44 分</td>
                                                <td>mm</td>
                                                <td>2 分钟前 ... 44 分钟前</td>
                                            </tr>
                                            <tr>
                                                <td>45 到 89 分</td>
                                                <td>h</td>
                                                <td>1 小时前</td>
                                            </tr>
                                            <tr>
                                                <td>90 分 到 21 小时</td>
                                                <td>hh</td>
                                                <td>2 小时前 ... 21 小时前</td>
                                            </tr>
                                            <tr>
                                                <td>22 到 35 小时</td>
                                                <td>d</td>
                                                <td>1 天前</td>
                                            </tr>
                                            <tr>
                                                <td>36 小时 到 25 天</td>
                                                <td>dd</td>
                                                <td>2 天前 ... 25 天前</td>
                                            </tr>
                                            <tr>
                                                <td>26 到 45 天</td>
                                                <td>M</td>
                                                <td>1 个月前</td>
                                            </tr>
                                            <tr>
                                                <td>46 天 到 10 月</td>
                                                <td>MM</td>
                                                <td>2 个月前 ... 10 个月前</td>
                                            </tr>
                                            <tr>
                                                <td>11 月 到 17 月</td>
                                                <td>y</td>
                                                <td>1 年前</td>
                                            </tr>
                                            <tr>
                                                <td>18 月以上</td>
                                                <td>yy</td>
                                                <td>2 年前 ... 20 年前</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <h2><a id="isleapyear" class="anchor" aria-hidden="true" href="#isleapyear"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>IsLeapYear</h2>
                                    <ul>
                                        <li>IsLeapYear 增加了 <code>.isLeapYear</code> API 返回一个 <code>boolean</code> 来展示一个 <code>Dayjs</code>'s 的年份是不是闰年。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">isLeapYear</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/isLeapYear'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">isLeapYear</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2000-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isLeapYear</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// true</span></pre></div>
                                    <h3><a id="buddhistera" class="anchor" aria-hidden="true" href="#buddhistera"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>BuddhistEra</h3>
                                    <ul>
                                        <li>BuddhistEra 扩展了 <code>dayjs().format</code> API 以支持佛历格式化。</li>
                                        <li>佛历是一个年份编号系统，主要用于柬埔寨、老挝、缅甸和泰国等东南亚国家以及斯里兰卡、马来西亚和新加坡的中国人，用于宗教或官方场合（[Wikipedia]（https：//en.wikipedia.org/wiki/Buddhist_calendar））</li>
                                        <li>要计算 BE 年，只需在年份中添加 543。 例如，1977 年 5 月 26 日 AD / CE 应显示为 2520 年 5 月 26 日 BE（1977 + 543）</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">buddhistEra</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/buddhistEra'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">buddhistEra</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-s">'BBBB BB'</span><span class="pl-kos">)</span></pre></div>
                                    <p>List of added formats:</p>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>Format</th>
                                                <th>Output</th>
                                                <th>Description</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td><code>BBBB</code></td>
                                                <td>2561</td>
                                                <td>Full BE Year (Year + 543)</td>
                                            </tr>
                                            <tr>
                                                <td><code>BB</code></td>
                                                <td>61</td>
                                                <td>2-digit of BE Year</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <h3><a id="issameorafter" class="anchor" aria-hidden="true" href="#issameorafter"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>IsSameOrAfter</h3>
                                    <ul>
                                        <li>IsSameOrAfter 增加了 <code>.isSameOrAfter()</code> API 返回一个 <code>boolean</code> 来展示一个时间是否和一个时间相同或在一个时间之后.</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">isSameOrAfter</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/isSameOrAfter'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">isSameOrAfter</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-20'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isSameOrAfter</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-19'</span><span class="pl-kos">,</span> <span class="pl-s">'year'</span><span class="pl-kos">)</span></pre></div>
                                    <h3><a id="issameorbefore" class="anchor" aria-hidden="true" href="#issameorbefore"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>IsSameOrBefore</h3>
                                    <ul>
                                        <li>IsSameOrBefore 增加了 <code>.isSameOrBefore()</code> API 返回一个 <code>boolean</code> 来展示一个时间是否和一个时间相同或在一个时间之前.</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">isSameOrBefore</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/isSameOrBefore'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">isSameOrBefore</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-20'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isSameOrBefore</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-19'</span><span class="pl-kos">,</span> <span class="pl-s">'year'</span><span class="pl-kos">)</span></pre></div>
                                    <h3><a id="isbetween" class="anchor" aria-hidden="true" href="#isbetween"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>IsBetween</h3>
                                    <ul>
                                        <li>IsBetween 增加了 <code>.isBetween()</code> API 返回一个 <code>boolean</code> 来展示一个时间是否介于两个时间之间.</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">isBetween</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/isBetween'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">isBetween</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-20'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isBetween</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-19'</span><span class="pl-kos">,</span> <span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-10-25'</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s">'year'</span><span class="pl-kos">)</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2016-10-30'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isBetween</span><span class="pl-kos">(</span><span class="pl-s">'2016-01-01'</span><span class="pl-kos">,</span> <span class="pl-s">'2016-10-30'</span><span class="pl-kos">,</span> null<span class="pl-kos">,</span> <span class="pl-s">'[)'</span><span class="pl-kos">)</span>
<span class="pl-c">// '[' 包含, '(' 不包含</span></pre></div>
                                    <h3><a id="dayofyear" class="anchor" aria-hidden="true" href="#dayofyear"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>DayOfYear</h3>
                                    <ul>
                                        <li>DayOfYear 增加了 <code>.dayOfYear()</code> API 返回一个 <code>number</code> 来表示 <code>Dayjs</code> 的日期是年中第几天，或设置成是年中第几天。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">dayOfYear</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/dayOfYear'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">dayOfYear</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">dayOfYear</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 1</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">dayOfYear</span><span class="pl-kos">(</span><span class="pl-c1">365</span><span class="pl-kos">)</span> <span class="pl-c">// 2010-12-31</span></pre></div>
                                    <h3><a id="weekofyear" class="anchor" aria-hidden="true" href="#weekofyear"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>WeekOfYear</h3>
                                    <ul>
                                        <li>WeekOfYear 增加了 <code>.week()</code> API 返回一个 <code>number</code> 来表示 <code>Dayjs</code> 的日期是年中第几周.</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">weekOfYear</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/weekOfYear'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">weekOfYear</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'06/27/2018'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">week</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 26</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2018-06-27'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">week</span><span class="pl-kos">(</span><span class="pl-c1">5</span><span class="pl-kos">)</span> <span class="pl-c">// 设置周</span></pre></div>
                                    <h3><a id="weekday" class="anchor" aria-hidden="true" href="#weekday"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>WeekDay</h3>
                                    <ul>
                                        <li>WeekDay 增加了 <code>.weekday()</code> API 来获取或设置当前语言的星期。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">weekday</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/weekday'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">weekday</span><span class="pl-kos">)</span>
<span class="pl-c">// when Monday is the first day of the week</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">weekday</span><span class="pl-kos">(</span><span class="pl-c1">-</span><span class="pl-c1">7</span><span class="pl-kos">)</span> <span class="pl-c">// last Monday</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">weekday</span><span class="pl-kos">(</span><span class="pl-c1">7</span><span class="pl-kos">)</span> <span class="pl-c">// next Monday</span></pre></div>
                                    <h3><a id="isoweeksinyear" class="anchor" aria-hidden="true" href="#isoweeksinyear"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>IsoWeeksInYear</h3>
                                    <ul>
                                        <li>IsoWeeksInYear 增加了 <code>.isoWeeksInYear()</code> API 返回一个 <code>number</code> 来得到依据 ISO week 标准一年中有几周</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">isoWeeksInYear</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/isoWeeksInYear'</span>
<span class="pl-k">import</span> <span class="pl-s1">isLeapYear</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/isLeapYear'</span> <span class="pl-c">// rely on isLeapYear plugin</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">isoWeeksInYear</span><span class="pl-kos">)</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">isLeapYear</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2004-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isoWeeksInYear</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 53</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2005-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">isoWeeksInYear</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 52</span></pre></div>
                                    <h3><a id="quarterofyear" class="anchor" aria-hidden="true" href="#quarterofyear"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>QuarterOfYear</h3>
                                    <ul>
                                        <li>QuarterOfYear 增加了 <code>.quarter()</code> API 返回一个 <code>number</code> 来表示 <code>Dayjs</code> 的日期是第几个季度，并扩展了 <code>.add</code> <code>.subtract</code> <code>.startOf</code> <code>.endOf</code> API 来支持 <code>quarter</code>                                            季度单位。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">quarterOfYear</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/quarterOfYear'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">quarterOfYear</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-04-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">quarter</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// 2</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2010-04-01'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">quarter</span><span class="pl-kos">(</span><span class="pl-c1">2</span><span class="pl-kos">)</span></pre></div>
                                    <h3><a id="customparseformat" class="anchor" aria-hidden="true" href="#customparseformat"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>CustomParseFormat</h3>
                                    <ul>
                                        <li>CustomParseFormat 拓展了 <code>dayjs()</code> 支持自定义时间格式.</li>
                                    </ul>
                                    <p>使用方括号来表示需要保留的字符 (e.g. <code>[G]</code>) .</p>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">customParseFormat</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/customParseFormat'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">customParseFormat</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'05/02/69 1:02:03 PM -05:00'</span><span class="pl-kos">,</span> <span class="pl-s">'MM/DD/YY H:mm:ss A Z'</span><span class="pl-kos">)</span>
<span class="pl-c">// Returns an instance containing '1969-05-02T18:02:03.000Z'</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2018 五月 15'</span><span class="pl-kos">,</span> <span class="pl-s">'YYYY MMMM DD'</span><span class="pl-kos">,</span> <span class="pl-s">'zh_cn'</span><span class="pl-kos">)</span>
<span class="pl-c">// Returns an instance containing '2018-05-15T00:00:00.000Z'</span></pre></div>
                                    <h4><a id="list-of-all-available-format-tokens" class="anchor" aria-hidden="true" href="#list-of-all-available-format-tokens"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>List
                                        of all available format tokens</h4>
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>格式</th>
                                                <th>例子</th>
                                                <th>描述</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td><code>YY</code></td>
                                                <td>18</td>
                                                <td>两位数的年份</td>
                                            </tr>
                                            <tr>
                                                <td><code>YYYY</code></td>
                                                <td>2018</td>
                                                <td>四位数的年份</td>
                                            </tr>
                                            <tr>
                                                <td><code>M</code></td>
                                                <td>1-12</td>
                                                <td>月份，从 1 开始</td>
                                            </tr>
                                            <tr>
                                                <td><code>MM</code></td>
                                                <td>01-12</td>
                                                <td>月份，两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>MMM</code></td>
                                                <td>Jan-Dec</td>
                                                <td>简写的月份名称</td>
                                            </tr>
                                            <tr>
                                                <td><code>MMMM</code></td>
                                                <td>January-December</td>
                                                <td>完整的月份名称</td>
                                            </tr>
                                            <tr>
                                                <td><code>D</code></td>
                                                <td>1-31</td>
                                                <td>月份里的一天</td>
                                            </tr>
                                            <tr>
                                                <td><code>DD</code></td>
                                                <td>01-31</td>
                                                <td>月份里的一天，两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>H</code></td>
                                                <td>0-23</td>
                                                <td>小时</td>
                                            </tr>
                                            <tr>
                                                <td><code>HH</code></td>
                                                <td>00-23</td>
                                                <td>小时，两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>h</code></td>
                                                <td>1-12</td>
                                                <td>小时, 12 小时制</td>
                                            </tr>
                                            <tr>
                                                <td><code>hh</code></td>
                                                <td>01-12</td>
                                                <td>Hours, 12 小时制, 两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>m</code></td>
                                                <td>0-59</td>
                                                <td>分钟</td>
                                            </tr>
                                            <tr>
                                                <td><code>mm</code></td>
                                                <td>00-59</td>
                                                <td>分钟，两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>s</code></td>
                                                <td>0-59</td>
                                                <td>秒</td>
                                            </tr>
                                            <tr>
                                                <td><code>ss</code></td>
                                                <td>00-59</td>
                                                <td>秒 两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>S</code></td>
                                                <td>0-9</td>
                                                <td>毫秒 一位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>SS</code></td>
                                                <td>00-99</td>
                                                <td>毫秒 两位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>SSS</code></td>
                                                <td>000-999</td>
                                                <td>毫秒 三位数</td>
                                            </tr>
                                            <tr>
                                                <td><code>Z</code></td>
                                                <td>+05:00</td>
                                                <td>UTC 的偏移量</td>
                                            </tr>
                                            <tr>
                                                <td><code>ZZ</code></td>
                                                <td>+0500</td>
                                                <td>UTC 的偏移量，数字前面加上 0</td>
                                            </tr>
                                            <tr>
                                                <td><code>A</code></td>
                                                <td>AM PM</td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><code>a</code></td>
                                                <td>am pm</td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><code>Do</code></td>
                                                <td>1st... 31st</td>
                                                <td>带序号的月份</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <h3><a id="toarray" class="anchor" aria-hidden="true" href="#toarray"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ToArray</h3>
                                    <ul>
                                        <li>ToArray 增加了 <code>.toArray()</code> API 来返回包含时间数值的数组。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">toArray</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/toArray'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">toArray</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2019-01-25'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toArray</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">// [ 2019, 0, 25, 0, 0, 0, 0 ]</span></pre></div>
                                    <h3><a id="toobject" class="anchor" aria-hidden="true" href="#toobject"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>ToObject</h3>
                                    <ul>
                                        <li>ToObject 增加了 <code>.toObject()</code> API 来返回包含时间数值的对象。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">toObject</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/toObject'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">toObject</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2019-01-25'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toObject</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-c">/* { years: 2019,</span>
<span class="pl-c">     months: 0,</span>
<span class="pl-c">     date: 25,</span>
<span class="pl-c">     hours: 0,</span>
<span class="pl-c">     minutes: 0,</span>
<span class="pl-c">     seconds: 0,</span>
<span class="pl-c">     milliseconds: 0 } */</span></pre></div>
                                    <h3><a id="minmax" class="anchor" aria-hidden="true" href="#minmax"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>MinMax</h3>
                                    <ul>
                                        <li>MinMax 增加了 <code>.min</code> <code>.max</code> API 返回一个 <code>dayjs</code> 来比较传入的 dayjs 实例的大小。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">minMax</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/minMax'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">minMax</span><span class="pl-kos">)</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">max</span><span class="pl-kos">(</span><span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2018-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2019-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">min</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2018-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2019-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">)</span></pre></div>
                                    <h3><a id="calendar" class="anchor" aria-hidden="true" href="#calendar"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Calendar</h3>
                                    <ul>
                                        <li>Calendar 增加了 <code>.calendar</code> API 返回一个 <code>string</code> 来显示日历时间。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">calendar</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/calendar'</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">calendar</span><span class="pl-kos">)</span>

<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">calendar</span><span class="pl-kos">(</span><span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-s">'2008-01-01'</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
<span class="pl-en">dayjs</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">calendar</span><span class="pl-kos">(</span>null<span class="pl-kos">,</span> <span class="pl-kos">{</span>
  <span class="pl-c1">sameDay</span>: <span class="pl-s">'[今天] HH:mm'</span><span class="pl-kos">,</span> <span class="pl-c">// 今天 ( 今天 2:30 AM )</span>
  <span class="pl-c1">nextDay</span>: <span class="pl-s">'[明天]'</span><span class="pl-kos">,</span> <span class="pl-c">// 明天 ( 明天 2:30 AM )</span>
  <span class="pl-c1">nextWeek</span>: <span class="pl-s">'[下]dddd'</span><span class="pl-kos">,</span> <span class="pl-c">// 下周 ( Sunday at 2:30 AM )</span>
  <span class="pl-c1">lastDay</span>: <span class="pl-s">'[昨天]'</span><span class="pl-kos">,</span> <span class="pl-c">// 昨天 ( 昨天 2:30 AM )</span>
  <span class="pl-c1">lastWeek</span>: <span class="pl-s">'[上] dddd'</span><span class="pl-kos">,</span> <span class="pl-c">// 上周 ( Last Monday at 2:30 AM )</span>
  <span class="pl-c1">sameElse</span>: <span class="pl-s">'DD/MM/YYYY'</span> <span class="pl-c">// 其他情况 ( 7/10/2011 )</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
                                    <h3><a id="updatelocale" class="anchor" aria-hidden="true" href="#updatelocale"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>UpdateLocale</h3>
                                    <ul>
                                        <li>UpdateLocale 增加了 <code>.updateLocale</code> API 来更新语言配置的属性。</li>
                                    </ul>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">import</span> <span class="pl-s1">updateLocale</span> <span class="pl-k">from</span> <span class="pl-s">'dayjs/plugin/updateLocale'</span>
<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">extend</span><span class="pl-kos">(</span><span class="pl-s1">updateLocale</span><span class="pl-kos">)</span>

<span class="pl-s1">dayjs</span><span class="pl-kos">.</span><span class="pl-en">updateLocale</span><span class="pl-kos">(</span><span class="pl-s">'en'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
  <span class="pl-c1">months</span> : <span class="pl-v">String</span><span class="pl-kos">[</span><span class="pl-s1"></span><span class="pl-kos">]</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
                                    <h2><a id="自定义" class="anchor" aria-hidden="true" href="#自定义"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>自定义</h2>
                                    <p>你可以根据需要自由的编写一个 Day.js 插件</p>
                                    <p>欢迎提交 PR 与大家分享你的插件</p>
                                    <p>Day.js 插件模版</p>
                                    <div class="highlight highlight-source-js"><pre><span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-kos">(</span><span class="pl-s1">option</span><span class="pl-kos">,</span> <span class="pl-s1">dayjsClass</span><span class="pl-kos">,</span> <span class="pl-s1">dayjsFactory</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-c">// 扩展 dayjs() 实例</span>
  <span class="pl-c">// 例：添加 dayjs().isSameOrBefore() 实例方法</span>
  <span class="pl-s1">dayjsClass</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-en">isSameOrBefore</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">arguments</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

  <span class="pl-c">// 扩展 dayjs 类</span>
  <span class="pl-c">// 例：添加 dayjs.utc() 类方法</span>
  <span class="pl-s1">dayjsFactory</span><span class="pl-kos">.</span><span class="pl-en">utc</span> <span class="pl-c1">=</span> <span class="pl-smi">arguments</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

  <span class="pl-c">// 覆盖已存在的 API</span>
  <span class="pl-c">// 例：扩展 dayjs().format() 方法</span>
  <span class="pl-k">const</span> <span class="pl-s1">oldFormat</span> <span class="pl-c1">=</span> <span class="pl-s1">dayjsClass</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-c1">format</span>
  <span class="pl-s1">dayjsClass</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-en">format</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">arguments</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c">// 原始format结果</span>
    <span class="pl-k">const</span> <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-s1">oldFormat</span><span class="pl-kos">(</span><span class="pl-s1">arguments</span><span class="pl-kos">)</span>
    <span class="pl-c">// 返回修改后结果</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
                                    <!--/scrapbook-capture-selected-->
                                </article>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <script src="https://unpkg.com/dayjs"></script>
    <script src="https://unpkg.com/dayjs@1.8.19/plugin/weekday.js"></script>
    <script src="https://unpkg.com/dayjs@1.8.19/plugin/weekYear.js"></script>
</body>

</html>